package com.qasystem.qa.core.common;

import com.qasystem.qa.core.constants.Constants;
import com.sun.xml.internal.ws.policy.EffectiveAlternativeSelector;

import javax.servlet.http.Cookie;

public class CookieFactory {
    public static Cookie getCookieInstance (String cookieName,String token) {
        Cookie cookie = new Cookie(cookieName, token);
        cookie.setMaxAge(30 * 60);
        cookie.setPath("/");
        return cookie;
    }
    public static boolean isExistCookie (Cookie[] cookies) {
        if (cookies != null) {
            for (Cookie cookie : cookies) {
                if (cookie.getName().equals(Constants.COOKIE_NAME)) {
                    return true;
                }
            }
        }
        return false;
    }

}
